home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / locale / localeinfo.h < prev    next >
C/C++ Source or Header  |  1992-10-07  |  5KB  |  209 lines

  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /* Locale-specific information.  */
  20.  
  21. #ifndef    _LOCALEINFO_H
  22.  
  23. #define    _LOCALEINFO_H    1
  24.  
  25. #define    __need_size_t
  26. #define    __need_wchar_t
  27. #include <stddef.h>
  28. #include <limits.h>
  29.  
  30.  
  31. /* Change these if the `wchar_t' type is changed.  */
  32. #define    WCHAR_MAX    ((wchar_t) UCHAR_MAX)
  33.  
  34.  
  35. /* Used by multibyte char functions.  */
  36. typedef struct
  37. {
  38.   char *string;            /* Bytes.  */
  39.   size_t len;            /* # of bytes.  */
  40.   long int shift;        /* # of mb_char's to shift.  */
  41. } mb_char;
  42.  
  43. struct ctype_mbchar_info
  44. {
  45.   size_t mb_max;        /* Max MB char length.  */
  46.   mb_char *mb_chars;        /* MB chars.  */
  47. };
  48.  
  49. struct ctype_ctype_info
  50. {
  51.   unsigned short int *ctype_b;    /* Characteristics.  */
  52.   short int *ctype_tolower;    /* Case mappings.  */
  53.   short int *ctype_toupper;    /* Case mappings.  */
  54. };
  55.  
  56. struct ctype_info
  57. {
  58.   struct ctype_ctype_info *ctype;
  59.   struct ctype_mbchar_info *mbchar;
  60. };
  61.  
  62. extern __const struct ctype_info *_ctype_info;
  63.  
  64. /* These are necessary because they are used in a header file.  */
  65. extern __const unsigned short int *__ctype_b;
  66. extern __const short int *__ctype_tolower;
  67. extern __const short int *__ctype_toupper;
  68.  
  69.  
  70. /* Used by strcoll and strxfrm.  */
  71. typedef struct
  72. {
  73.   unsigned char *values;
  74.   size_t nvalues;
  75. } literal_value;
  76.  
  77. typedef struct
  78. {
  79.   union
  80.   {
  81.     literal_value literal;
  82.     /* %%% This may become a regex_t in the future.  */
  83.     char *regexp;
  84.   } replace, with;
  85.   unsigned int regexp:1;
  86. } subst;
  87.  
  88. struct collate_info
  89. {
  90.   size_t nsubsts;
  91.   subst *substs;
  92.  
  93.   unsigned char *values;
  94.   unsigned char *offsets;
  95. };
  96.  
  97. extern __const struct collate_info *_collate_info;
  98.  
  99.  
  100. /* Used by strtod, atof.  */
  101. struct numeric_info
  102. {
  103.   char *decimal_point;
  104.   char *thousands_sep;
  105.   char *grouping;
  106. };
  107.  
  108. extern __const struct numeric_info *_numeric_info;
  109.  
  110.  
  111. /* Used in the return value of localeconv.  */
  112. struct monetary_info
  113. {
  114.   char *int_curr_symbol;
  115.   char *currency_symbol;
  116.   char *mon_decimal_point;
  117.   char *mon_thousands_sep;
  118.   char *mon_grouping;
  119.   char *positive_sign;
  120.   char *negative_sign;
  121.   char int_frac_digits;
  122.   char frac_digits;
  123.   char p_cs_precedes;
  124.   char p_sep_by_space;
  125.   char n_cs_precedes;
  126.   char n_sep_by_space;
  127.   char p_sign_posn;
  128.   char n_sign_posn;
  129. };
  130.  
  131. extern __const struct monetary_info *_monetary_info;
  132.  
  133.  
  134. /* Used by strftime, asctime.  */
  135. struct time_info
  136. {
  137.   char *abbrev_wkday[7];    /* Short weekday names.  */
  138.   char *full_wkday[7];        /* Full weekday names.  */
  139.   char *abbrev_month[12];    /* Short month names.  */
  140.   char *full_month[12];        /* Full month names.  */
  141.   char *ampm[2];        /* "AM" and "PM" strings.  */
  142.  
  143.   char *date_time;        /* Appropriate date and time format.  */
  144.   char *date;            /* Appropriate date format.  */
  145.   char *time;            /* Appropriate time format.  */
  146.  
  147.   char *ut0;            /* Name for GMT.  */
  148.   char *tz;            /* Default TZ value.  */
  149. };
  150.  
  151. extern __const struct time_info *_time_info;
  152.  
  153. struct response_info
  154. {
  155.   /* Regexp for affirmative answers.  */
  156.   char *yesexpr;
  157.  
  158.   /* Regexp for negative answers.  */
  159.   char *noexpr;
  160. };
  161.  
  162. extern __const struct response_info *_response_info;
  163.  
  164. /* Locale structure.  */
  165. typedef struct
  166. {
  167.   char *name;
  168.   int categories;
  169.  
  170.   unsigned int allocated:1;
  171.  
  172.   int subcategories;
  173.   size_t num_sublocales;
  174.   struct sub_locale *sublocales;
  175.  
  176.   __ptr_t *info;
  177. } locale;
  178.  
  179. typedef struct sub_locale
  180. {
  181.   unsigned int pointer:1;
  182.  
  183.   int categories;
  184.   char *name;
  185.  
  186.   locale *locale;
  187. } sublocale;
  188.  
  189.  
  190. /* This is the magic number that localeinfo object files begin with.
  191.    In case you're wondering why I chose the value 0x051472CA, it's
  192.    because I was born on 05-14-72 in Oakland, CA.  */
  193. #define    LIMAGIC        0x051472CA
  194. /* This is the magic number that precedes each category-specific section
  195.    of a localeinfo object file.  It's the arbitrary magic number above,
  196.    but modified by the category so that it's different from the per-file
  197.    magic number and unique for each category.  */
  198. #define    CATEGORY_MAGIC(x)    (LIMAGIC ^ (x))
  199.  
  200. extern __const char *__lidir, *__lidefault;
  201.  
  202. extern locale *__find_locale __P ((int categories, __const char *name));
  203. extern locale *__new_locale __P ((locale *));
  204. extern locale *__localefile __P ((__const char *file));
  205. extern void __free_locale __P ((locale *));
  206.  
  207.  
  208. #endif /* localeinfo.h  */
  209.